package com.example.hehecat.yuejian1.mvp.presenter;

import android.util.Log;

import com.example.hehecat.yuejian1.mvp.contract.GameCollectContract;
import com.example.hehecat.yuejian1.mvp.model.GameCollectModel;
import com.example.hehecat.yuejian1.mvp.model.bean.GameBean;

import java.util.List;

import rx.Subscriber;

import static com.chad.library.adapter.base.listener.SimpleClickListener.TAG;

public class GameCollectPresenter implements GameCollectContract.Presenter {
    private GameCollectContract.Model model;
    private GameCollectContract.View view;

    public GameCollectPresenter(GameCollectContract.View view){
        this.view = view;
        model = new GameCollectModel();
    }

    @Override
    public void updateAdapterData(int user_id) {
        model.getAllGameCollect(user_id, new Subscriber<List<GameBean>>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

            }

            @Override
            public void onNext(List<GameBean> gameBeans) {
                Log.d(TAG,"onNext" +gameBeans.get(0).getGamename());
                view.updateAdapterData(gameBeans);
            }
        });
    }
}
